import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)
import {getStudyListsAll,getTeacherListsAll} from '@/api/index.js'
export default new Vuex.Store({
  state: {
    allStudyList:[],
    allTeacherList:[],
  },
  mutations: {
    SET_studyLIST(state,data) {
      state.allStudyList = data;
    },
    SET_teacher_LIST(state,data) {
      state.allTeacherList = data;
    }
  },
  actions: {
    // 获取学生列表
    getStudyListAll ({ commit, state }){
      getStudyListsAll({bSName:'',bDisability_Type:'',bZt:'',bSort:'',bSx:''}).then((res) => {
        if(res) {
          commit('SET_studyLIST',res);
        }
      })
    },
    // 获取教师列表
    getTeacherListAll ({ commit, state }){
      getTeacherListsAll({bT_Name:'',bSx:'',bSort:''}).then((res) => {
        if(res) {
          commit('SET_teacher_LIST',res);
        }
      })
    }
  }
})
